<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title>员工入职表</title>
        <style type="text/css">
            .tb{
                margin: 50px auto;
                border: 1px solid cornflowerblue;
            }
            .tb_1{
                background-color:  coral;
                text-align: center;
            }
            .tb_2 {
                text-align: center;
            }
        </style>
    </head>
    <body>
    <table class="tb" width="820" border='1'cellspacing="0" cellpadding="10" >
    <tbody>
    <tr>
    <th>ID</th><th>姓名</th><th>所属部门</th><th>头像</th><th>出生日期</th><th>入职时间</th><th>相关操作</th>
    </tr>
    </tr>
    <?php
     require_once'index.php';
    $sql="SELECT * FROM  `tb_emp`";
    $result = $dd->query($sql);
                            ?>
    <?php if ($result->num_rows > 0):?>
    <?php 
    $rows = $result->fetch_all(MYSQLI_ASSOC);
    foreach($rows as $row){ ?>  
    
    <tr class="tb_2">
      <td><?php echo $row["e_id"]  ;?></td>
      <td><?php echo $row["e_name"] ; ?></td>
      <td><?php echo $row["e_dept"] ; ?></td>
      <td><img src= '<?php echo $row["e_img"] ; ?>' alt="" /></td>
      <td><?php echo $row["date_of_birth"] ; ?></td>
      <td><?php echo $row["date_of_entry"] ; ?></td>
      <td> <a class="compile" href="javascript:" onclick="if(confirm('确定编辑吗？')) location.href='#'" >编辑</a>
          
        <a class="delete" href="javascript:" onclick="if(confirm('确定删除吗？')) location.href='delete.php?id=<?php echo $row['e_id'] ; ?>'" >删除</a>
    </td>
    </tr>
    <?php } ; ?>
    <?php else : ?>
    <p>0个结果</p>
    <?php endif; ?>
  </tbody>
</table>
    </body>
</html>